package com.th.kuang.mapper;

import com.th.kuang.pojo.User;
import org.mybatis.spring.SqlSessionTemplate;
import org.mybatis.spring.support.SqlSessionDaoSupport;
import org.springframework.transaction.PlatformTransactionManager;

import java.util.List;

/**
 * @author ThreePure
 * @date 20/12/21 8:57
 * @description: TODO
 * @since 1.8
 */
public class UserMapperImpl extends SqlSessionDaoSupport implements UserMapper{


    @Override
    public List<User> selectUserList() {
        User user = new User(6, "欧冠", "123321");
        UserMapper mapper = getSqlSession().getMapper(UserMapper.class);

        mapper.addUser(user);
        mapper.deleteUser(7);
        return mapper.selectUserList();
    }

    /**
     * 添加一个用户
     *
     * @param user
     */
    @Override
    public int addUser(User user) {
        return getSqlSession().getMapper(UserMapper.class).addUser(user);
    }

    /**
     * 删除一个用户
     *
     * @param id
     */
    @Override
    public int deleteUser(int id) {
        return getSqlSession().getMapper(UserMapper.class).deleteUser(id);
    }
}
